package mark.tom.fiter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import mark.tom.fiter.bean.config.OkHttpConfig;

public final class Buz {

    private final ResponseResolver resolver;
    private final ProcessConverter converter;
    private final NetErrorInterceptor netErrorInterceptor;
    private final OkHttpConfig okHttpConfig;

    private Buz(Builder builder) {
        resolver = builder.resolver;
        converter = builder.converter;
        netErrorInterceptor = builder.netErrorInterceptor;
        okHttpConfig = builder.okHttpConfig;
    }

    @Nullable
    ProcessConverter getConverter() {
        return converter;
    }

    @Nullable
    ResponseResolver getResolver() {
        return resolver;
    }

    @Nullable NetErrorInterceptor getNetErrorInterceptor() {
        return netErrorInterceptor;
    }

    @Nullable
    OkHttpConfig getOkHttpConfig() {
        return okHttpConfig;
    }

    public static final class Builder {
        private ResponseResolver resolver;
        private ProcessConverter converter;
        private NetErrorInterceptor netErrorInterceptor;
        private OkHttpConfig okHttpConfig;

        public Builder() {
        }

        public Builder converter(@NonNull ProcessConverter val) {
            converter = val;
            return this;
        }

        public Builder resolver(@NonNull ResponseResolver val) {
            resolver = val;
            return this;
        }

        public Builder netInterceptor(@NonNull NetErrorInterceptor val) {
            netErrorInterceptor = val;
            return this;
        }

        public Builder okHttpConfig(@NonNull OkHttpConfig val) {
            okHttpConfig = val;
            return this;
        }

        public Buz build() {
            return new Buz(this);
        }
    }
}
